<?php

namespace app\api\controller;

use app\api\logic\EmailLogic;
use app\api\validate\SendEmailValidate;


/**
 * 邮件
 * Class EmailController
 * @package app\api\controller
 */
class EmailController extends BaseApiController
{

    public array $notNeedLogin = ['sendCode'];


    /**
     * @notes 发送邮箱验证码
     * @return \think\response\Json
     * @author 段誉
     * @date 2022/9/15 16:17
     */
    public function sendCode()
    {
        $params = (new SendEmailValidate())->post()->goCheck();
        $result = EmailLogic::sendCode($params);
        if (true === $result) {
            return $this->success('发送成功');
        }
        return $this->fail(EmailLogic::getError());
    }

}